package com.hualan.sfzy.service.impl;

import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import com.hualan.sfzy.entity.Cspi;
import com.hualan.sfzy.entity.Fm;
import com.hualan.sfzy.entity.FmClassification;
import com.hualan.sfzy.mapper.FmClassificationMapper;
import com.hualan.sfzy.service.FmClassificationService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.Collections;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

@Service
public class FmClassificationServiceImpl implements FmClassificationService {

    @Autowired
    FmClassificationMapper fmClassificationMapper;

    @Override
    public int add(FmClassification entity) {
        return 0;
    }

    @Override
    public int addSelective(FmClassification entity) {
        return fmClassificationMapper.insert(entity);
    }


    @Override
    public int edit(FmClassification entity) {
        return fmClassificationMapper.update(entity);
    }

    @Override
    public int remove(Integer id) {
        return fmClassificationMapper.delete(id);
    }

    @Override
    public int removeBatch(Integer[] ids) {
        return fmClassificationMapper.deleteBatch(ids);
    }

    @Override
    public List<FmClassification> find() {
        return Collections.emptyList();
    }

    @Override
    public Map<String, Object> findPage(Integer pageNum, Integer pageSize, FmClassification entity) {
        PageHelper.startPage(pageNum,pageSize);
        List<FmClassification> list = fmClassificationMapper.fuzzySelectSeletive(entity);
        PageInfo<FmClassification> pageInfo = new PageInfo<>(list);
        Map<String, Object> map = new HashMap<>();
        map.put("pageInfo", pageInfo);
        return map;
    }

    @Override
    public FmClassification findById(Integer id) {
        return fmClassificationMapper.selectById(id);
    }

    @Override
    public List<FmClassification> findAll() {
        return fmClassificationMapper.selectAll();
    }


}
